

list_a = [1,2,'3',4.3]
list_new = []
for a in list_a:
    a = int(a) + 1
    list_new.append(a)
    print(a)
print(list_new)

for i in range(0,len(list_a)):
    print(type(list_a[i]))

#切片
print(list_a[0:2])
print(list_a[1:2])
print(list_a[:3])
print(list_a[1:])

list_a=[[1,2],[3,4]]
for a in list_a:
    for b in a:
        print(b)


while len(list_new)<10:
    list_new.append(1)

# or  and
print(f'{list_new}')

try :
    a=None
    b = a + 1
    print(b)
except Exception as e:
    print(e)

# return 跳出当前执行函数

#continue 跳过当前循环
for i in list_new:
    if i == 1:
        continue
    else:
        print(i)

# break 跳出当前循环





